Repository navigation
feat(service-knowledge): search inside chosen records — the record scope, by the records a source indexes or by a parent through a listed lookup - #37342
Conversation
…nds its adapter (#37324) A second dated note under the table of K8, and a second Amended bullet in the header list. The note records the maintainer's ruling on Q3 (ruling record 7168192820) and gives item 17 its final shape: the member is AdapterSearchOptions.scope, a list of terms the service builds from scope: [{ object, ids }] and the adapter applies before it ranks. No code, no schema, no changeset. The status line is left as it is. Claude-Session: https://claude.ai/code/session_01JQwxbZmjM1KubX3ZAoJPPm Co-authored-by: Claude <noreply@anthropic.com>
…ords, or to the records under one parent
ADR-0161 K8 item 17, as its dated note of 2026-11-25 shapes it.
- spec: KnowledgeSearchOptions.scope [{ object, ids }] with its bounds;
AdapterSearchOptions.scope and the AdapterScopeTerm type (record /
metadata terms), the bounds and the service's check stated on the member.
- service-knowledge: knowledge-search-scope.ts holds a scope to its bounds
(VALIDATION_ERROR 400 before any adapter is called), builds each source's
terms (own object -> record term; a parent -> the one listed lookup or
master_detail field pointing at it, read through referenceTargetOf; user
fields, withheld fields and two-or-more links reach nothing), and checks
every hit after the adapter answers, fail closed, logging once per adapter.
A source no entry reaches is not searched; an empty scope answers nothing.
- knowledge-memory: applies the scope before ranking (first reader).
- testing.ts: implements.scope; per-term-kind adapter cases and cases through
a real KnowledgeService, one over the adapter with the member stripped.
- docs: protocol "Record scope" section; RAG guide section.
Claude-Session: https://claude.ai/code/session_01JQwxbZmjM1KubX3ZAoJPPm
Co-authored-by: Claude <noreply@anthropic.com>
📓 Docs Drift CheckThis PR changes 4 package(s): 3 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:
What this run could not see
Coarse fallback — 176 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): Which tree this was computed onThis run read A worktree cut from an older # while this PR is open — GitHub drops the merge commit once it closes
git fetch origin 1dca7cd3c8a601a03e872fa9ba2078e48a1b55e5 && git checkout 1dca7cd3c8a601a03e872fa9ba2078e48a1b55e5
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 02520ab4808e46fa708ca257b11981499079d3ae 760716bcbbcc3e4a64ae9ecae9b710d76743b289 && git checkout -B drift-repro 02520ab4808e46fa708ca257b11981499079d3ae && git merge --no-ff 760716bcbbcc3e4a64ae9ecae9b710d76743b289
node scripts/docs-audit/affected-docs.mjs --json 02520ab4808e46fa708ca257b11981499079d3ae
|
|
repo:cloud#1 · os-warren · session_01JQwxbW5anP6GDaVi5LKi2U 维护者速读
席位核对REWORK — the member, its reader and the suite cases match the dated K8 note and every acceptance scene is pinned, but the head has one red check caused by the diff and conflicts with Head-sha: Read whole at this head against 形态
门禁 check-runs (at
逐项核对与消融 (21 single-change ablations at this head in a scratch worktree, each restored; worktree removed)
dev 所提三问的裁定
安全清点表的归类 (asked by the coordinator)
逐句核的散文面
修复清单
接受的偏差
范围外去向
落地条款
Contract reviewServed-tier: ① Derived judgments
② Semver level
③ Boundary flags
④ Design judgment
Findings open at this head: two must-fix, three should-fix, four nits. Implemented-by: VERDICT: FAIL |
The record-level search landed on main (#37335). search() keeps both source filters: the record scope first, then groupBy, each after the scope and groupBy options are validated. KnowledgeHit.metadata now says an adapter returns the document's metadata on each hit, which the service's scope check reads (review ruling (b)). Claude-Session: https://claude.ai/code/session_01JQwxbZmjM1KubX3ZAoJPPm Co-authored-by: Claude <noreply@anthropic.com>
…arent and that an adapter cannot widen the check - A service case: a parent-scoped search makes no engine call naming the parent object, and an adapter that widens the terms it was handed (more ids, an extra term) still has every out-of-scope hit dropped; every round is handed the service's own terms. - AdapterSearchOptions.scope: a metadata term's field is a name from the source's metadataFields; the ids are the caller's strings as given, checked only against the bounds, so an adapter binds them as parameters. - parentLinksOf: drop the self-target guard; the own-object entry is answered before the links are read, so the guard changed no answer. - The RAG guide says an adapter that reads the scope filters before it ranks, and that the service's check may leave an ignoring adapter short of topK. Claude-Session: https://claude.ai/code/session_01JQwxbZmjM1KubX3ZAoJPPm Co-authored-by: Claude <noreply@anthropic.com>
|
repo:cloud#1 · os-warren · session_01JQwxbW5anP6GDaVi5LKi2U 维护者速读
席位核对REWORK — the round-1 fixes that were in the dev's reach are closed at this head and the merge of Head-sha: Delta review: two commits on 形态
门禁 check-runs (at
逐项核对与消融 (4 single-change ablations at this head in a scratch worktree, each restored; worktree removed)
逐句核的散文面 (delta sentences)
修复清单
接受的偏差 (unchanged from round 1)
范围外去向 (unchanged)
落地条款
Contract reviewServed-tier: ① Derived judgments
② Semver level
③ Boundary flags
④ Design judgment
Findings open at this head: one must-fix (waits on the maintainer), two should-fix (one of them the PR body), one nit. Implemented-by: VERDICT: FAIL |
… record granularity A scoped search with groupBy, and one with granularity 'record', over an adapter that ignores the scope: every round is handed the record term, and no out-of-scope record answers. Red when the scope is skipped under groupBy or under record granularity, and when the groupBy source filter rebuilds its entries without the terms. Claude-Session: https://claude.ai/code/session_01JQwxbZmjM1KubX3ZAoJPPm Co-authored-by: Claude <noreply@anthropic.com>
…read census knowledge-search-scope.ts names the object a knowledge source's listed lookup points at, only to turn a scope entry naming that parent into a filter on the source's own stored lookup value. It reads no record of the parent and serves nothing of it: kind not-a-served-read, pinned by the service case that a parent-scoped search makes no engine call naming the parent object. Claude-Session: https://claude.ai/code/session_01JQwxbZmjM1KubX3ZAoJPPm Co-authored-by: Claude <noreply@anthropic.com>
|
repo:cloud#1 · os-warren · session_01JQwxbW5anP6GDaVi5LKi2U 维护者速读
席位核对ACCEPT — the two open items of the round-2 record (PR comment 7173187773) are closed at this head, each verified from the diff and by ablation, and nothing else moved. Landing waits for the checks still running. Head-sha: Delta review: two commits on 形态
门禁 check-runs (at
逐项核对与消融 (3 single-change ablations at this head in a scratch worktree, each restored; worktree removed)
接受的偏差 (unchanged)
范围外去向 (unchanged)
落地条款
Contract reviewServed-tier: ① Derived judgments
② Semver level
③ Boundary flags
④ Design judgment
No must-fix, no should-fix. Implemented-by: VERDICT: PASS |
knowledge-pgvector and the index fingerprint landed on main (#37337). searchWithRefusals validates the scope first, filters the admitted sources by the scope and then by groupBy, and planSearches carries each source's terms beside its fingerprint: searchRound hands the adapter both `index` and `scope`. SearchTarget declares the terms, and sourcesGroupableBy keeps the type of what it filters. The suite, the stubs, knowledge-memory and the protocol sample declare both the generation keys and `scope`. Claude-Session: https://claude.ai/code/session_01JQwxbZmjM1KubX3ZAoJPPm Co-authored-by: Claude <noreply@anthropic.com>
…after merging main The merge took both sides of the two generated artifacts without a text merge; regenerated from the merged tree, they list main's AdapterIndexExpectation and AdapterIndexStatus beside AdapterScopeTerm. Claude-Session: https://claude.ai/code/session_01JQwxbZmjM1KubX3ZAoJPPm Co-authored-by: Claude <noreply@anthropic.com>
knowledge-pgvector landed first (#37337), so it implements the scope as every in-tree adapter that runs the suite does (#37308 item 4). The terms are a union in the same inner WHERE as the organization filter, before ranking: a record term on source_record_id, a metadata term on the stored jsonb value of its field (a string or number equal to an id as text, or a list with such an element; anything else holds for nothing). Ids and field names go as bound parameters. A scope with no term that has ids ranks nothing. The live contract run declares implements.scope, so the suite's record-term, metadata-term and service-level parent cases run against PostgreSQL. Claude-Session: https://claude.ai/code/session_01JQwxbZmjM1KubX3ZAoJPPm Co-authored-by: Claude <noreply@anthropic.com>
|
repo:cloud#1 · os-warren · session_01JQwxbW5anP6GDaVi5LKi2U 维护者速读
席位核对ACCEPT — the merge of Head-sha: Delta review: three commits on 形态
门禁 check-runs (at
逐项核对与消融 (4 single-change ablations at this head in a scratch worktree, each restored; worktree removed)
逐句核的散文面 (delta sentences)
修复清单
接受的偏差 (unchanged, plus one)
范围外去向 (unchanged)
落地条款
Contract reviewServed-tier: ① Derived judgments
② Semver level
③ Boundary flags
④ Design judgment
No must-fix, no should-fix. Implemented-by: VERDICT: PASS |
Brings #37342 (record scope). Conflict in content/docs/protocol/knowledge.mdx's adapter table: both rows kept. Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JQwxbaMuehXzctoWq7iRsV
…ng (ADR-0161 K8 item 17) Mirrors knowledge-pgvector's scope from #37342: the terms are ORed inside the organization-filtered WHERE, a record term on source_record_id, a metadata term on a stored string or number equal to an id as text or a list with such an element. Ids go as one bound JSON array per term; a field name is a bound value compared with the stored keys, never a JSON path. A scope with no term that has ids answers [] before any query. The contract suite runs with implements.scope: true. Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JQwxbaMuehXzctoWq7iRsV
Requested by Warren · project thread
Fixes #37308
Clause-②: yes
Metadata-protocol: none
维护者速读
d1ca7f01)。开源向量库那个改动先合并了,本分支已合入主干,并让向量库也按范围过滤(在数据库里先筛再排序);由座位做差量复核后重新排队合并。「按记录返回」已合并并合入本分支;与开源向量库那个改动仍有文字冲突,后合并的一方处理。What changes
ADR-0161 K8 item 17, in the shape its dated note of 2026-11-25 (#37324, merged as
13ffe1c0) gives it, built in one PR as the note says: the member, its first reader inknowledge-memory, and the suite cases.@objectstack/spec(types only, no metadata key):KnowledgeSearchOptions.scope?: Array<{ object: string; ids: string[] }>(packages/spec/src/contracts/knowledge-service.ts): an option of the service, not a contract member. Its TSDoc states the own-object and parent readings, union, absent/empty, and the bounds with the coded refusal.AdapterSearchOptions.scope?: AdapterScopeTerm[]and the exported typeAdapterScopeTerm(packages/spec/src/contracts/knowledge-adapter.ts):{ kind: 'record', ids }or{ kind: 'metadata', field, ids }. Its TSDoc states absent/present/empty, the AND withorganizationIdsandfilter, the bounds an adapter can rely on (at most 10 terms, at most 500 ids each, every id a non-empty string), and that the service checks every hit after the answer, so an adapter returns the document'smetadataon its hits.api-surface/contracts.json,export-origins/contracts.json(the new export).@objectstack/service-knowledge:src/knowledge-search-scope.ts:readSearchScope: the bounds,SEARCH_SCOPE_MAX_ENTRIES = 10,SEARCH_SCOPE_MAX_IDS = 500. Past them it throwscode: 'VALIDATION_ERROR',status: 400(ADR-0112), naming the bound, before anything else insearchruns.scopeTermsFor: an entry naming the source's object gives arecordterm. An entry naming another object gives ametadataterm on the onemetadataFieldsmember that is alookupormaster_detailfield whosereferenceTargetOfis that object, read from the registered definition. Auserfield, a withheld (credential-class orinternal) field, a field whose target cannot be read, two or more such fields, no definition, and afile/httpsource all give nothing.scopeCheck: the hit check. It judgessourceRecordIdormetadata[field], compares strings and numbers byString(v), and matches a list when any element matches. Anything else, or no value, fails closed.KnowledgeService.search:sourcesInScopepairs each admitted source with its terms. A source no entry reaches is not searched (debug). The two-lookup ambiguity is logged once per source and object atwarn, naming the fields.searchRoundhands each adapter a copy of its terms and checks every hit after the answer. The first drop for an adapter is logged once atwarn.answeredstays the adapter's own count.src/testing.ts(the contract suite):implements.scope.implements.scopeis true: a record term filters before ranking (topK 1); a metadata term with a list value returns the document's metadata; the number 7 matches'7'; terms are a union; an empty list or a term with no ids ranks nothing; without the member everything is ranked; withorganizationIds, both apply.KnowledgeServicefor every adapter: an own-object scope fills topK from in-scope passages; a parent scope works through the listed lookup; an adapter with the member stripped answers no out-of-scope hit, and the service logs once.serviceOvergainsschemas,stripScopeandlogger.@objectstack/knowledge-memory: appliesscopeafter the organization filter and before scoring. It declaresimplements.scope: true.@objectstack/knowledge-pgvector(landed first, #37337): appliesscopein the same innerWHEREas the organization filter, beforeORDER BY/LIMIT. Arecordterm issource_record_id = ANY($n::text[]); ametadataterm holds when the stored jsonb value of its field is a string or number equal to an id as text, or a list with such an element. Ids and field names are bound parameters only. A scope with no term that has ids answers[]before any query. Its live contract run declaresimplements.scope: true.Docs:
content/docs/protocol/knowledge.mdx: a new "Record scope" section in §5, a pointer in §3.4, the suite sample, and §4.1 / the adapter table naming pgvector's record scope.content/docs/ai/knowledge-rag.mdx: a new "Searching inside chosen records" section.Changeset: patch for the four packages, with
Clause-②: yesandMetadata-protocol: none. The change adds no metadata key, and a non-protocol widening ships patch.Tests
src/__tests__/knowledge-search-scope.test.ts: bounds (each refusal, and the exact-bound acceptance), term building (each reading of the note), and the hit check.src/__tests__/knowledge-service.test.ts, new describe "search scope (ADR-0161 K8, item 17)":groupBy, and one withgranularity: 'record', over an adapter that ignores the scope: every round is handed the record term and no out-of-scope record answers (review round 2).knowledge-memoryand both stubs.knowledge-memorywith its scope filter removed: 7 suite cases fail.KnowledgeServicewithout the after-answer check: 7 cases fail across the stubs and the service tests.groupBy, skipping it under record granularity, or thegroupBysource filter rebuilding its entries without the terms: the round-2 case fails.Local runs at
760716bc(after mergingmainat98bda0ac, which brought #37337):pnpm --filter @objectstack/spec buildandcheck:generated: exit 0, after the merge's deferred regeneration ofapi-surface/contracts.jsonandexport-origins/contracts.json(4552e7c4).pnpm --filter @objectstack/service-knowledge typecheckandcheck:test-typecheck: exit 0.test: 13 files, 365 tests passed.pnpm --filter @objectstack/knowledge-memory typecheckandcheck:test-typecheck: exit 0.test: 2 files, 56 tests passed.pnpm --filter @objectstack/knowledge-pgvector typecheck: exit 0.testagainst a local PostgreSQL 16 with pgvector,OS_TEST_POSTGRES_URLset andOS_EXPECT_LIVE_DIALECT_MATRIX=1: 4 files, 67 tests passed, every scope case of the suite among them (record term, metadata term with a list, the number 7, union, empty, absent, withorganizationIds; through the service: own object, the parent through the listed lookup, the member stripped). With the SQL scope filter removed: 7 of them fail.pnpm --filter @objectstack/core test:repo(the census pin, atd1ca7f01): 8 files, 110 tests passed.760716bc.dispatch-gates --commandsderives 119 commands from the 19 changed paths (the 118 before, pluspnpm check:kernel-hook-pairs). Each was run at this head with its output in its own file and its exit code read before any pipe.check:dual-build-cjs-loadsfirst answered 3 (prerequisite not met: the newknowledge-pgvectorhad nodist/); afterpnpm --filter @objectstack/knowledge-pgvector buildit was run again, and the record holds that run.The 119 commands at
760716bcnode scripts/check-adr-0087-registration.mjs --base origin/mainnode scripts/check-adr-0087-registration.mjs --self-testnode scripts/check-adr-links.mjsnode scripts/check-adr-links.mjs --self-testnode scripts/check-changeset-no-major.mjs --base origin/mainnode scripts/check-closing-keyword-parity.mjsnode scripts/check-closing-keyword-parity.mjs --self-testnode scripts/check-comment-mask-adoption.mjsnode scripts/check-comment-mask-adoption.mjs --self-testnode scripts/check-comment-mask-corpus.mjsnode scripts/check-dev-prereqs.mjs --self-testnode scripts/check-doc-route-spelling.mjs --advisorynode scripts/check-doc-route-spelling.mjs --self-testnode scripts/check-docs-section-name.mjsnode scripts/check-docs-section-name.mjs --self-testnode scripts/check-dts-emitted.mjs --self-testnode scripts/check-empty-changeset.mjs --base origin/mainnode scripts/check-empty-changeset.mjs --self-testnode scripts/check-issue-citations.mjsnode scripts/check-plugin-teardown-shape.mjsnode scripts/check-plugin-teardown-shape.mjs --self-testnode scripts/check-section-landing-index.mjsnode scripts/check-section-landing-index.mjs --self-testnode scripts/check-tenant-audit-census.mjsnode scripts/check-tenant-audit-census.mjs --self-testnode scripts/ci/assert-turbo-remote-cache.mjs --self-testnode scripts/ci/plan-test-core-shards.mjs --self-testnode scripts/ci/prune-turbo-cache.mjs --self-testnode scripts/ci/snapshot-next.mjs --self-testnode scripts/docs-audit/check-affected-docs.mjsnode scripts/docs-audit/check-drift-comment.mjsnode scripts/pm/check-governed-queue-guard.mjs --self-testnode scripts/pm/release-rehearsal-clone.mjs --self-testnode scripts/release-pending-publish.mjs --self-testpnpm --filter @objectstack/lint run check:doc-formula-expressionspnpm --filter @objectstack/lint run check:doc-security-posturepnpm --filter @objectstack/spec run check:api-surfacepnpm --filter @objectstack/spec run check:authorable-surfacepnpm --filter @objectstack/spec run check:browser-reachable-entriespnpm --filter @objectstack/spec run check:docspnpm --filter @objectstack/spec run check:dual-source-exportspnpm --filter @objectstack/spec run check:duration-unit-keyspnpm --filter @objectstack/spec run check:empty-statepnpm --filter @objectstack/spec run check:entry-nameabilitypnpm --filter @objectstack/spec run check:error-code-provenancepnpm --filter @objectstack/spec run check:export-originspnpm --filter @objectstack/spec run check:exported-anypnpm --filter @objectstack/spec run check:generatedpnpm --filter @objectstack/spec run check:livenesspnpm --filter @objectstack/spec run check:llms-txtpnpm --filter @objectstack/spec run check:skill-examplespnpm --filter @objectstack/spec run check:skill-refspnpm --filter @objectstack/spec run check:strictness-ledgerpnpm --filter @objectstack/spec run check:variant-docspnpm --filter @objectstack/spec run check:yaml-examplespnpm check:adr-anchorspnpm check:adr-symbol-anchorspnpm check:changeset-gate-self-testspnpm check:ci-filter-paritypnpm check:closed-ceremony-textpnpm check:corpus-claim-driftpnpm check:cross-package-test-inputspnpm check:dispatcher-error-vocabularypnpm check:doc-anchorspnpm check:doc-authoringpnpm check:doc-frontmatterpnpm check:docs-audit-scopepnpm check:docs-redirectspnpm check:docs-single-h1pnpm check:docs-spec-enumerationspnpm check:docs-transcript-driftpnpm check:driver-memory-censuspnpm check:dts-closurepnpm check:engine-double-contractpnpm check:error-status-conformancepnpm check:gitlink-declaredpnpm check:init-service-contractpnpm check:issue-citationspnpm check:kernel-hook-pairspnpm check:keyed-text-boundspnpm check:lean-entry-closurepnpm check:logger-receiver-detachpnpm check:merge-driverpnpm check:nul-bytespnpm check:object-def-param-keyspnpm check:objectql-double-limitpnpm check:optional-error-sinkpnpm check:org-identifierpnpm check:package-namingpnpm check:page-declaration-shapepnpm check:platform-object-tenancy-censuspnpm check:pm-expected-skipspnpm check:pm-prior-rulingspnpm check:published-filespnpm check:published-readme-linkspnpm check:query-options-erasurepnpm check:react-page-adapter-contractpnpm check:refd-timer-probepnpm check:registry-log-declaredpnpm check:rest-log-spy-declaredpnpm check:role-wordpnpm check:settings-bind-windowpnpm check:skill-identifier-livenesspnpm check:slot-lookuppnpm check:sourcemap-no-sources-contentpnpm check:spec-docblock-symbol-anchorspnpm check:spec-parsed-aliaspnpm check:startup-registry-verdictpnpm check:system-context-censuspnpm check:test-source-aliaspnpm check:tier-file-adoptionpnpm check:type-check-coveragepnpm check:type-check-debtpnpm check:undeclared-dep-importspnpm check:vendor-version-stampspnpm check:vouch-for-reference-callerspnpm check:watch-hint-literalpnpm check:where-matcherpnpm check:dual-build-cjs-loadsEarlier heads ran the 118 then derived, all exit 0:
857a2e20(after three prerequisites were met) andca5a0c11.Acceptance notes
The five points carried from #37329's contract review:
metadatais stated onAdapterSearchOptions.scopeand onKnowledgeHit.metadata(packages/spec/src/ai/knowledge-document.zod.ts, added in the merge ofmainunder the seat's claim amendment, review ruling (b)). It is pinned: the suite's metadata-term case and the parent case through the service both asserthit.metadata.policy.scopeCheck, on the adapter in the suite, and through the service (a lookup stored as the number 7 matches'7'). Only strings and numbers compare. An object,nullor a boolean never matches, so'[object Object]'cannot be matched by accident.organizationIds: []). A caller that computes ids (the records on screen, a policy's children) then needs no special case for "none". The tool argument (search_knowledge: the one definition gains scope, granularity and groupBy, for the MCP door and the in-app agent alike #37311) can still refuse at its own door.INlist, and a search hands at most 5,000 ids in all. ⚑ This PR owes a ceiling-tier contract review (CONTRACT_REVIEW_TIER) for the new member.filter. Finding for the seat to file:KnowledgeSearchOptions.filter/AdapterSearchOptions.filterhas no producer in this tree. The one non-test caller ofIKnowledgeService.search,createKnowledgeTools, passes none, and the service gives it no guarantee after the answer. This PR leaves it unchanged and builds nothing from it. Whether it retires is its own card. Carrier: none · noted, not filed. Dedupe words: knowledge opaque filter, AdapterSearchOptions filter retire, KnowledgeSearchOptions filter producer.What the note left to this PR, decided here:
answeredstays the adapter's own count, so whether a source may hold more is still judged on what it returned. The refill after the permission filter counts records among the hits that passed both checks.warn, once per adapter. It is a deployment defect, and rule 2 says nothing is skipped silently.warn, once per source and object. It is an authoring defect.debug, per search, because it is normal under a scope.field) is refused rather than ignored. Afieldkey is the note's deferred alternative, so it fails loud instead of silently reading as something else. An id that is not a non-empty string is refused: the contract types ids as strings, and a stored numeric value still matches its string id.Surface and overlap:
api-surface/contracts.json,export-origins/contracts.json), required bycheck:generatedfor the new export.packages/spec/src/ai/knowledge-document.zod.ts: one TSDoc sentence, inside the claim as the seat amended it.packages/core/src/security/second-object-read-exposure.pin.test.ts: oneCALLERSrow, kindnot-a-served-read, forknowledge-search-scope.ts, in its own commitd1ca7f01, after the maintainer approved it on the card thread (2026-11-25 22:48Z). The census pin requires every caller ofreferenceTargetOfto be classified; the seat's review agrees with the kind. The row cites the service case that a parent-scoped search makes no engine call naming the parent object. Run atd1ca7f01:pnpm --filter @objectstack/core test:repo, 8 files, 110 tests passed.scripts/adr-anchorsentry: review ruling (c), not owed.knowledge-ragflowdoes not run the suite and ignoresscope(Retire @objectstack/knowledge-ragflow: package, settings option, docs and skill mentions #37004 retires it). The service's check keeps its answers in scope. A parent scope answers nothing from it if its hits carry no metadata.mainis merged again at93c70347.searchWithRefusalsvalidates the scope first; the admitted sources are filtered by the scope, then bygroupBy, then planned (planSearchescarries each source's terms beside its fingerprint,SearchTarget.scope), andsearchRoundhands the adapter bothindexandscope. The suite'simplements, the stubs,knowledge-memoryand the protocol sample declare the generation keys andscope.mainwas merged into this branch at67f11a57.search()validates the scope,groupByandgranularityfirst, then filters the admitted sources by the scope (sourcesInScope) and then bygroupBy(sourcesGroupableBy). Every round of the record-level path goes throughsearchRound, so every round is handed the terms and checked.packages/plugins/knowledge-pgvector/**: inside the claim as the seat widened it after feat(knowledge): knowledge-pgvector, an open vector store on PostgreSQL, and the index fingerprint (#37100) #37337 landed (service-knowledge: search takes a record scope (scope: [{ object, ids }]) and hands adapters a typed filter they apply before ranking #37308 item 4): the scope filter insearch(),implements.scope, and nothing else.overlap-checkat760716bc:main, feat(service-knowledge): register EMBEDDER_SERVICE from the ai.embedder_* settings when the knowledge service is mounted #37265 and feat(metadata): listPackageBindings reads an item's package from its stored row's package column #37187 merge cleanly.Verification
Read first:
packages/services/service-knowledge/src/knowledge-search-scope.ts: the whole module (bounds, term building, hit check).KnowledgeService.search/sourcesInScope/searchRound/checkScopeinknowledge-service.ts: the three-line change at the top ofsearch, and the check after the answer.packages/spec/src/contracts/.Two-minute check: run
pnpm --filter @objectstack/service-knowledge exec vitest run --maxWorkers=2 src/__tests__/knowledge-search-scope.test.ts src/__tests__/knowledge-service.test.ts -t scope. Then open the "search scope" describe and read the acceptance case "20 records, two of them in scope, topK 5".Generated by Claude Code